<template>
	<view class="pageBox">
		<image class="topBG" src="@/static/common/talentService_banner.png" mode="scaleToFill"></image>
		<view class="contentBox">
			<view class="itemBox">
				<image class="img" src="@/static/common/talentService1.png"
					@click.stop="goto('my/serve/rideHailing/rideHailing',0)">
				</image>
				<view class="" @click.stop="goto('my/serve/rideHailing/rideHailing',0)">约车</view>
			</view>
			<view class="itemBox">
				<image class="img" src="@/static/common/talentService2.png"
					@click.stop="goto('my/serve/agent/agent',3)">
				</image>
				<view class="" @click.stop="goto('my/serve/agent/agent',3)">代办</view>
			</view>
			<view class="itemBox">
				<image class="img" src="@/static/common/talentService3.png"
					@click.stop="goto('my/serve/repair/repair',2)">
				</image>
				<view class="" @click.stop="goto('my/serve/repair/repair',2)">物业报修</view>
			</view>
			<view class="itemBox">
				<image class="img" src="@/static/common/talentService4.png"
					@click.stop="goto('my/serve/Housekeeping/Housekeeping',1)"></image>
				<view class="" @click.stop="goto('my/serve/Housekeeping/Housekeeping',1)">家政</view>
			</view>
		</view>
		<u-modal :show="rzShow" title="提示" content="请先提交认证申请成为人才!" confirmText="去提交" showCancelButton cancelText="取消"
			@confirm="toRZ" @close="RZX" @cancel="RZX"></u-modal>
	</view>
</template>

<script>
	import {
		hasServePermission
	} from "@/api/autth"
	export default {
		data() {
			return {
				rzShow: false,
				userInfo: null
			}
		},
		mounted() {
			this.userInfo = this.$store.getters.my_userInfo
			if (!this.userInfo) {
				this.$store.dispatch('userBaseInfo').then(res => {
					this.userInfo = res.user
				})
			}
		},
		onLoad(options) {},
		onShow() {

		},
		methods: {
			toRZ() {
				uni.$u.debounce(() => {
					this.$navTo(`pages/common/authentication/authentication`)
					this.rzShow = false
				}, 500)
			},
			RZX() {
				this.rzShow = false
			},
			goto(url, serveId) {
				// this.$navTo(`pages/${url}`)
				hasServePermission(serveId).then(res => {
					if (res.data) {
						this.$navTo(`pages/${url}`)
					}
				}).catch(err => {
					if (!err.data && this.userInfo.userType == 'yk') {
						this.rzShow = true
					} else {
						this.$toast('无权限')
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pageBox {

		.topBG {
			width: 100%;
			object-fit: cover;
			height: 500rpx;
		}

		.contentBox {
			display: flex;
			flex-wrap: wrap;
			align-items: flex-start;

			.itemBox {
				text-align: center;
				width: 25%;
				padding-top: 30rpx;

				.img {
					height: 128rpx;
					width: 128rpx;
					object-fit: cover;
					margin-bottom: 20rpx;
				}

				.text {
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #000000;
				}
			}
		}
	}
</style>